import moment from 'moment'

const filters = {
  filterPlayCount (count) {
    if (count >= 100000000) {
      return count.toString().replace(count.toString().substr(-8, 8), '亿')
    } else if (count >= 10000) {
      return count.toString().replace(count.toString().substr(-4, 4), 'W')
    } else {
      return count
    }
  },
  filterPlayTime (time) {
    return moment(time).format('mm:ss')
  },
  filterArtists (name) {
    return name
      .map(item => {
        return item.name
      })
      .join(' / ')
  }
}

export default filters
